package com.example.score.entity;

import lombok.Data;

/**
 * 知识点得分信息辅助类
 */
@Data
public class KnowledgeScoreInfo {
    private double totalScore;
    private double totalFullScore;

    public KnowledgeScoreInfo(double totalScore, double totalFullScore) {
        this.totalScore = totalScore;
        this.totalFullScore = totalFullScore;
    }

    //
    public KnowledgeScoreInfo() {
        this.totalScore = 0.0;
        this.totalFullScore = 0.0;
    }

    public void addScore(double score, double fullScore) {
        this.totalScore += score;
        this.totalFullScore += fullScore;
    }

    public double getScoreRate() {
        return totalFullScore > 0 ? totalScore / totalFullScore : 0;
    }
}
